In Python 2.x, range generates the entire sequence when called, while xrange is a generator - it produces values on demand, not all up fromt. You will often see xrange is used much more frequently than range. This is for one reason only - resource usage.